package twel.probenprophet.helden.heroes;

import java.util.Collection;

import javax.inject.Inject;
import javax.inject.Singleton;

import twel.probenprophet.helden.heroes.helden5.ZippedHeroesLoader;
import twel.probenprophet.helden.heroes.helden5.jaxb.Hero;

@Singleton
public class HeroRepository {

	private final ZippedHeroesLoader zippedHeroesLoader;

	@Inject
	public HeroRepository(ZippedHeroesLoader zippedHeroesLoader) {
		this.zippedHeroesLoader = zippedHeroesLoader;
	}

	public Collection<Hero> getHeroesFromZipFile(String zippedHeroesPath) {
		return zippedHeroesLoader.loadFromZipFile(zippedHeroesPath);
	}

	public Collection<Hero> getHeroesFromHeldenDefaultLocation() {
		String defaultPath = System.getProperty("user.home") + "/helden.zip.hld";
		return getHeroesFromZipFile(defaultPath);
	}
}
